package com.bw.controller;

import com.bw.entity.Zzt;
import com.bw.mapper.TuMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class TuController {

    @Autowired
    TuMapper tuMapper;

    @RequestMapping("/tu.do")
    public String tu() {

        return "tu";
    }

    @RequestMapping("/zzt.do")
    @ResponseBody
    public List<Zzt> zzt(String group) {
        List<Zzt> zztList = tuMapper.zzt(group);
        return zztList;
    }

    @RequestMapping("/excel.do")
    public void excel(String group, HttpServletResponse response) {
        List<Zzt> zztList = tuMapper.zzt(group);
        ExcelUtils.exportExcel(zztList, "学生数量导出", "sheet11", response);
    }
}
